package com.yin.myproject;

/**
 * @author Eason
 * @create 2018-04-01 12:35
 **/
public class ClassAPIForSuperClass {

    public static void main(String[] args) {
        Class animalClazz = Animal.class;
        Class tigerClazz = Tiger.class;
        //获取Animal的父类
        Class animalSuperClass = animalClazz.getSuperclass();
        System.out.println("Animal super class :" + animalSuperClass.getName());
        //获取Tiger的父类
        Class tigerSuperClass = tigerClazz.getSuperclass();
        System.out.println("Tiger super class : " + tigerSuperClass.getName());
    }


    class Animal {
        private String id;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }
    }

    class Tiger extends Animal {
        private String name;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }
}
